package com.adminsystem.controller;

import com.adminsystem.entity.TestReq;
import com.adminsystem.entity.TestRes;
import com.adminsystem.entity.custom.Result;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "swaggerTest")
@Api(tags = "Swagger测试相关接口", description = "Swagger测试相关接口的描述")
//@ApiIgnore("临时测试类")
// @ApiIgnore(value = "不想在Swagger文档上显示")
public class SwaggerTestController {

    @GetMapping("test1")
    @ApiOperation(value = "test1接口", notes = "test1接口详细描述")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "aa", value = "aa的说明", defaultValue = "1", allowableValues = "1,2,3", required = true),
            @ApiImplicitParam(name = "bb", value = "bb的说明", defaultValue = "1", allowableValues = "1,2,3", required = true),
            @ApiImplicitParam(name = "cc", value = "cc的说明", defaultValue = "2", allowableValues = "1,2,3", required = true),
    })
    public Result test1(@RequestParam String aa, @RequestParam String bb, @RequestParam String cc) {
        return Result.success("success");
    }

    @GetMapping("test2")
    @ApiOperation(value = "test2接口", notes = "test2接口详细描述")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "请求成功", responseHeaders = {@ResponseHeader(name = "header1", description = "header1的描述", response = String.class)}),
            @ApiResponse(code = 401, message = "没有权限", responseHeaders = {@ResponseHeader(name = "header2", description = "header2的描述", response = String.class)}),
            @ApiResponse(code = 403, message = "禁止访问")
    })
    public Result test2(@ApiParam(value = "aa的说明") @RequestParam String aa, @ApiParam(value = "bb的说明") @RequestParam String bb) {
        return Result.success(new TestRes());
    }

    @PostMapping("test3")
    @ApiOperation(value = "test3接口", notes = "test3接口详细描述")
    public Result test3(@ApiParam(value = "请求类TestReq") @RequestBody TestReq testReq) {
        return Result.success(new TestRes());
    }
}
